home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-20 | 2.4 KB | 88 lines | [TEXT/CWIE] |
- ///////////////////////////////////////////////////////////////////////////////
- //
- // CPopupMenuControl.h
- //
- //
-
- #ifndef __CPOPUPMENUCONTROL__
- #define __CPOPUPMENUCONTROL__
-
- #include "BDConsts.h"
- #include "BDInterfaces.h"
- #include "CBaseControl.h"
- #include "CBaseEventServer.h"
- #include "CBaseEventClient.h"
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // Constants
- //
-
- const short MAX_NUM_MENU_ITEMS = 50; // an arbitrary limit. We could make this dynamic.
- const char MENUITEM_STR[] = "menuitem";
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // class declaration
- //
-
- class CPopupMenuControl :
- public CBaseControl,
- public CBaseEventServer,
- public CBaseEventClient,
- public IDoMenuEvents
- {
- public:
-
- // *** CPopupMenuControl methods ***
- CPopupMenuControl();
- ~CPopupMenuControl();
-
- // *** IUnknown methods ***
- STDMETHOD (QueryInterface)(REFIID refID, void** obj);
- STDMETHOD_(ULONG,AddRef)(THIS) {CBaseControl::AddRef();}
- STDMETHOD_(ULONG,Release)(THIS) {CBaseControl::Release();}
-
- // *** IObjectWithSite methods ***
- STDMETHOD (SetSite)(THIS_ IUnknown* inUnkSite);
-
- // *** IControl methods ***
- STDMETHOD (Draw) (THIS_ DrawContext* context);
- STDMETHOD (DoIdle)(THIS_ Uint32 idleRefCon);
-
- // *** IPersistPropertyBag methods ***
- STDMETHOD(Load)(IPropertyBag* propertyBag, IErrorLog* errorLog);
-
- // *** CBaseEventServer methods ***
- STDMETHOD (FireOneEvent)(REFIID refID, long eventID, IUnknown* eventTarget, EventRecord* event);
-
- // **** IDoMenuEvents methods
- STDMETHOD (Popup)(THIS_ IUnknown* source, PlatformEvent* event);
- STDMETHOD (Clear)(THIS_ IUnknown* source, PlatformEvent* event);
- STDMETHOD (RemoveItem)(THIS_ IUnknown* source, PlatformEvent* event, const CMenuItem & item);
- STDMETHOD (AddItem)(THIS_ IUnknown* source, PlatformEvent* event, const CMenuItem & item);
-
- protected:
- static short GetMenuRSRCID(void);
-
- protected:
- void AddMenuItem(char * itemName);
- void SetOriginatorName(char * theName);
-
- protected:
- char mOriginatorName[Str255BufferLength];
- MenuHandle mMenuHandle;
- CMenuItem mItemSelected;
- Str255 mMenuItemString[MAX_NUM_MENU_ITEMS];
- Boolean mIsIdling; // True if we're getting idle messages
- #ifdef _DEBUG
- char mThisName[256];
- #endif
-
- protected:
- static short gMenuRSRCID;
- };
-
-
- #endif // __CPOPUPMENUCONTROL__
-